<docs>
  ## 个人基本信息
</docs>
<template>
  <div class="con-layout resumeDetail noPadBottom">
    <my-bread title="简历详情" :goback="true" ref="head"></my-bread>
    <div class="content" ref="resumeContent" v-if="jlxx.grqzid">
      <!-- 基本信息 -->
      <div class="common">
        <div class="touxiang">
          <span class="collect sc" :class="sfsc ==0 ? '' : 'ysc'" @click="scFn">收藏</span>
          <div>
            <img class="images" :src="imgSrc" alt @click="showImg">
          </div>
        </div>
        <div class="point tem_comm">
          <p class="person">{{jbxx.xm}} | {{jbxx.xb_xs}} | {{jbxx.nl+'岁'}}</p>
          <p class="person">
            <span>{{jbxx.whcd_xs}}</span>
          </p>
          <div class="baseinfo overflow"><span>户籍地:</span> {{jbxx.hjdxzqh_xs}}</div>
          <div class="baseinfo"><span>居住地:</span> {{jbxx.jzdxzqh_xs}}</div>
          <p class="tel" v-if="jbxx.email || jbxx.sfgkdh ==1">
            <span class="tel_l" v-if="jbxx.sj && jbxx.sfgkdh ==1">{{jbxx.sj}}</span>
            <span class="email_r" v-if="jbxx.email">{{jbxx.email}}</span>
          </p>
        </div>
      </div>
      <!-- 求职意向 -->
      <div class="common job_intent" v-if="qzyx&&qzyx.length">
        <div class="title tem_comm">
          <p>求职意向</p>
        </div>
        <div class="point tem_comm" v-for="(item, index) in qzyx" :key="index">
          <p class="item">
            <span class="list_l">求职岗位:</span>
            <span class="list_r">{{item.gwmc}}</span>
          </p>
          <p class="item">
            <span class="list_l">用工形式:</span>
            <span class="list_r">{{item.ygxs_xs}}</span>
          </p>
          <p class="item">
            <span class="list_l">期望薪酬:</span>
            <span class="list_r">{{item.xc}}</span>
          </p>
          <p class="item">
            <span class="list_l">工作地区:</span>
            <span class="list_r">{{item.qwjydq_xs}}</span>
          </p>
        </div>
      </div>
      <!-- 工作经历开始 -->
      <div class="common" v-if="gzjl&&gzjl.length">
        <div class="title tem_comm">
          <p>工作经历</p>
        </div>
        <div
          class="edu_list tem_comm"
          :class="[index==0?'mt30':'',index == gzjl.length-1 ? 'mb30':'']"
          v-for="(item, index) in gzjl"
          :key="index"
        >
          <div class="circle"></div>
          <div class="point exper">
            <p>{{item.jzjzsj}}</p>
            <p class="collage">{{item.gzgw}}</p>
            <div class="item">
              <span class="list_r color9">{{item.dwmc}}</span>
            </div>
            <div class="item">
              <span style="color:#999;margin-right:10px;">工作职责:</span>
              <span class="list_r color9">{{item.gzsm}}</span>
            </div>
          </div>
        </div>
      </div>
      <!-- 职业技能开始 -->
      <div class="common" v-if="zyjn&&zyjn.length">
        <div class="title tem_comm">
          <p>职业技能</p>
        </div>
        <div class="point tem_comm" v-for="(item, index) in zyjn" :key="index">
          <div class="item">
            <span class="list_l">技能名称:</span>
            <span class="list_r">{{item.yyjnbm_xs}}</span>
          </div>
          <div class="item">
            <span class="list_l">技能等级:</span>
            <span class="list_r">{{item.jsdj_xs}}</span>
          </div>
        </div>
      </div>
      <!-- 教育经历开始 -->
      <div class="common" v-if="xxjl&&xxjl.length">
        <div class="title tem_comm">
          <p>学习经历</p>
        </div>
        <div class="point tem_comm" v-for="(item, index) in xxjl" :key="index">
          <div class="item">
            <span class="list_l">入学时间:</span>
            <span class="list_r">{{item.rxsj}}</span>
          </div>
          <div class="item">
            <span class="list_l">毕业时间:</span>
            <span class="list_r">{{item.bysj}}</span>
          </div>
          <div class="item">
            <span class="list_l">所在学校:</span>
            <span class="list_r">{{item.byyx}}</span>
          </div>
          <div class="item">
            <span class="list_l">所属学历:</span>
            <span class="list_r">{{item.sxzy_xs}}</span>
          </div>
          <div class="item" v-show="item.xxjlbz">
            <span class="list_l">备注:</span>
            <span class="list_r">{{item.xxjlbz}}</span>
          </div>
        </div>
      </div>
      <!-- 语言能力开始 -->
      <div class="common" v-if="yy&&yy.length">
        <div class="title tem_comm">
          <p>语言能力</p>
        </div>
        <div class="point tem_comm" v-for="(item, index) in yy" :key="index">
          <div class="item">
            <span class="list_l">语言能力</span>
            <span class="list_r">{{item.yyjnbm_xs}}</span>
          </div>
          <div class="item" v-show="item.xgsm">
            <span class="list_l">外语说明</span>
            <span class="list_r">{{item.xgsm}}</span>
          </div>
        </div>
      </div>
      <!-- 计算机开始 -->
      <!-- <div class="common">
      <div class="title tem_comm">
        <p>计算机</p>
      </div>
      <div class="point tem_comm" v-for="(item, index) in jsj" :key="index">
        <div class="item">
          <span class="list_l list_l_width">计算机能力</span>
          <span class="list_r">{{item.yyjnbm_xs}}</span>
        </div>
      </div>
      </div>-->
    </div>
    <div class="resume-button" ref="resumeBtn" v-if="jlxx.grqzid">
      <div class="button-item" @click="goLink" v-if="jlxx.butqx == 1|| jlxx.butqx == 2">邀请面试</div>
      <div class="button-item" v-if="jlxx.butqx == 2" @click="viewFn(50)">拒绝面试</div>
      <div class="button-item" v-if="jlxx.butqx == 3" @click="viewFn(20)">面试通过</div>
      <div class="button-item" v-if="jlxx.butqx == 3" @click="viewFn(30)">面试未通过</div>
      <div class="button-item" v-if="jlxx.butqx == 3" @click="viewFn(40)">未参加面试</div>
    </div>
    <van-image-preview v-model="imgShow" :images="imgArr" :showIndex="false">
    </van-image-preview>
  </div>
</template>
<script>
export default {
  name: "resumeDetail",
  data() {
    return {
      jlid: this.$route.query.jlid,
      tdjlid: this.$route.query.tdjlid,
      jlly:this.$route.query.jlly,
      jlxx: {}, //简历所有信息
      jbxx: {}, //基本信息
      qzyx: [], //求职意向
      xxjl: [], //学习经历
      gzjl: [], // 工作经历
      zyjn: [], //专业技能
      yy: [], //语言
      src: "", // 头像地址
      sfsc: 0, //是否收藏
      imgShow:false, //大图预览头像
      imgArr:[
        `${conf.urlPrefix}/dwgl/tpxxCx?jlid=${this.$route.query.jlid}`
      ]
    };
  },
  computed: {
    // 获取头像地址
    imgSrc() {
      return `${conf.urlPrefix}/dwgl/tpxxCx?jlid=${this.$route.query.jlid}`;
    }
  },
  methods: {
    showImg(){
      this.imgShow = true;
    },
    // 获取个人简历信息
    init() {
      this.$loading = true;
      this.$http({
        url: "/dwgl/jlxqCx",
        method: "get",
        params: {
          jlid: this.jlid,
          tdjlid: this.tdjlid,
          jlly:this.jlly
        }
      })
        .then(res => {
          let _res = res.returnData;
          if (+_res.executeResult == 1) {
            let data = _res.jlxx;
            this.jlxx = data; //简历所有信息
            this.jbxx = data.jbxx; //基本信息
            this.qzyx = data.qzyx; //求职意向
            this.xxjl = data.xxjl; //学习经历
            this.gzjl = data.gzjl; // 工作经历
            this.zyjn = data.zyjn; //专业技能
            this.yy = data.yy; //语言
            this.sfsc = data.sfsc; //是否收藏回显
            this.$nextTick(() => {
              this.initHeight();
            });
          } else {
            this.$alert({
              message: _res.message
            });
          }
        })
        .finally(() => {
          this.$loading = false;
        });
    },
    // 收藏事件
    scFn() {
      let ywcz = this.sfsc == 0 ? 2 : 3;
      this.$loading = true;
      this.$http({
        url: "/dwgl/jlscBc",
        method: "post",
        data: {
          jlid: this.jlid,
          dwdjid: this.jlxx.dwdjid,
          ywcz: ywcz,
          jlly:this.jlly
        }
      })
        .finally(() => {
          this.$loading = false;
        })
        .then(res => {
          let _res = res.returnData;
          if (+_res.executeResult == 1) {
            this.sfsc = ywcz == 2 ? 1 : 0;
            this.$toast({
              icon: "success",
              message: +this.sfsc ? "收藏成功" : "取消收藏成功"
            });
          } else {
            this.alert({
              message: _res.message
            });
          }
        });
    },
    // 动态设置内容padding值
    initHeight() {
      let btnHeight = this.$refs.resumeBtn.clientHeight;
      this.$refs.resumeContent.style.paddingBottom = btnHeight + 20 + "px";
    },
    // 邀请面试
    goLink() {
      this.$router.push({
        path: "/resume/inviteInterview",
        query: {
          jlid: this.jlxx.jlid,
          tdjlid: this.jlxx.tdjlid,
          grqzid: this.jlxx.grqzid,
          ckjlid: this.jlxx.ckjlid,
          fmstzly: this.$route.query.fmstzly || 1
        }
      });
    },
    // 面试按钮相关事件
    viewFn(tdzt) {
      let msg = tdzt == 50 ? "确定要拒绝当前面试吗？" : "确定执行当前操作吗？";
      this.$confirm(msg, "提示")
        .then(() => {
          this.$loading = true;
          this.$http({
            url: "/msgl/yyygcBc",
            method: "post",
            data: {
              tdzt: tdzt,
              tdjlid: this.jlxx.tdjlid,
              grqzid: this.jlxx.grqzid
            }
          }).finally(()=>{
          this.$loading = false;
          }).then(res => {
            let _res = res.returnData;
            if (+_res.executeResult == 1) {
              this.$alert({
                message: _res.message,
                cb:()=>{
                  this.$router.goBack();
                }
              });
            } else {
              this.$alert({
                message: _res.message
              });
              return false;
            }
          });
        })
        .catch(() => {});
    }
  },
  created() {
    this.init();
  }
};
</script>
<style scoped lang="scss">
@import "~common/scss/var.scss";
.iconfont {
  font-size: $font-size-large;
}
.bg_g {
  background-color: $color-bg;
}

// 求职意向
.job_intent {
  .title {
    position: relative;
    .icon-add {
      position: absolute;
      right: 0;
      top: 0;
      padding: 0 $padding-base;
      z-index: 5;
    }
  }
}
// 功能按钮
.resume-button {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 13px;
  z-index: 2;
  display: flex;
  justify-content: space-around;
  align-items: center;
  flex-wrap: wrap;
  .button-item {
    width: 331px;
    line-height: 83px;
    background-color: #06a8f6;
    color: #ffffff;
    font-size: 33px;
    text-align: center;
    border-radius: 6px;
    margin-bottom: 21px;
  }
}
</style>
